home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / ncsat.cpt / Telnet2.5 final / main / environ.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-05  |  3.4 KB  |  128 lines

  1. /*
  2. *    environ.c:
  3. *     by Gaige B. Paulsen
  4. ****************************************************************************
  5. *    Part of NCSA Telnet for the Macintosh                                   *
  6. *                                                                          *
  7. *      Uses    :                                                               *
  8. *      TCP/IP kernel for NCSA Telnet                                       *
  9. *      by Tim Krauskopf                                                    *
  10. *       with Macintosh code by Gaige B. Paulsen                                 *
  11. *                                                                          *
  12. *      National Center for Supercomputing Applications                     *
  13. *      152 Computing Applications Building                                 *
  14. *      605 E. Springfield Ave.                                             *
  15. *      Champaign, IL  61820                                                *
  16. *                                                                          *
  17. *                                                                          *
  18. ****************************************************************************
  19. *
  20. *        Code to set up the environment variables.
  21. *
  22. *    Called by:
  23. *        maclook.c
  24. */
  25.  
  26.  
  27. #include <Stdio.h>
  28.  
  29. #include <Types.h>
  30. #include <Dialogs.h>                /* BYU 2.4.15 */
  31. #include <OSUtils.h>
  32. #include <Script.h>
  33. #include <Errors.h>
  34.  
  35. #include "configrec.h"
  36. #include "maclook.h"
  37.  
  38. #define SYSENVIRON
  39. #define UnImplTrapNum 0x9f
  40. #define ScriptTrapNum 0xbf
  41. #define WNETrapNum 0x60
  42. #define SlotManagerNum 0x6E
  43.  
  44. #define CurrentVersion 1            /* Last known SysEnvirons version */
  45. #define HFSPtr ((long *)1014)
  46.  
  47. int Juggling;                            /* True if Multifinder is running */
  48. int ScriptManager;                        /* True if have scriptmanager */
  49. int HFS;                                /* True if HFS */
  50. int SlotManager;                        /* True if have slotmanager */
  51. int HasColor=0;                            /* True if have color quickdraw */
  52. long SysScriptKeys, SysScriptIcon;        /* The current script icon and keys */
  53. SysEnvRec theWorld;                        /* System Environment record */
  54.  
  55. int InquireEnvironment
  56.   (
  57.     void
  58.   )
  59. {
  60.     OSErr err;
  61.     long *HFSp=(long *)1014L;                /* I HATE LOW GLOBALS !!!! */
  62.  
  63.     HFS= (*HFSp) > 0L;
  64.     if (HFS) putln("Under HFS");    /* Check for HFS */
  65.         else putln("Under MFS");
  66.  
  67.     ScriptManager = GetTrapAddress(UnImplTrapNum) !=
  68.                     GetTrapAddress(ScriptTrapNum);
  69.     if (ScriptManager) {
  70.         SysScriptKeys= GetScript( smRoman, smScriptKeys);
  71.         SysScriptIcon= GetScript( smRoman, smScriptIcon);
  72.         }
  73.  
  74. #ifdef SYSENVIRON
  75.     err = SysEnvirons(CurrentVersion, &theWorld);
  76.     if (err == envVersTooBig) {
  77.         /* should post a message saying we need to be updated */
  78.         putln("SysEnvirons out of date!");
  79.     }
  80.     if (err != noErr)                /* possibly not available assume nothing here! */
  81.         return(0);
  82. #endif SYSENVIRON
  83.  
  84.     HasColor = theWorld.hasColorQD;
  85.  
  86. #ifdef NGETTRAP
  87.     Juggling =    NGetTrapAddress(WNETrapNum, ToolTrap) != 
  88.                 NGetTrapAddress(UnImplTrapNum, ToolTrap);
  89. #else
  90.     Juggling =    GetTrapAddress(WNETrapNum) != 
  91.                 GetTrapAddress(UnImplTrapNum);
  92. #endif
  93.     if (Juggling)
  94.         putln("Juggling!");        /* BYU */
  95.  
  96. #ifdef NGETTRAP
  97.     SlotManager =    NGetTrapAddress(SlotManagerNum, ToolTrap) != 
  98.                     NGetTrapAddress(UnImplTrapNum, ToolTrap);
  99. #endif
  100.     return(1);
  101. }
  102.  
  103. #ifdef AZTEC
  104. SysEnvirons( vreq, p)
  105. int vreq;
  106. SysEnvRec *p;
  107. {
  108.  
  109.     if (GetTrapAddress( 0xA090) == GetTrapAddress( UnImplTrapNum)) {
  110.         putln("No sysenvirons...");
  111.         return(-1);
  112.         }
  113.  
  114.     putln("Going In....");
  115.     if (0 == SECall( vreq, p)) {
  116.         putln("No Error");
  117.         return(0);
  118.         }
  119.     else return(-1);
  120. }
  121.  
  122. #asm
  123. _SECall    move.w    4(sp),d0
  124.         movea.l    6(sp),a0
  125.         dc.w    $a090
  126.         rts
  127. #endasm
  128. #endif AZTEC